<%@page contentType="text/html; charset=utf-8"%>
<%@page import="git.bankview.sl.schedule.PipelineFactory,java.sql.Date,java.text.SimpleDateFormat
				,java.util.Calendar,java.util.ArrayList,java.util.List" %>

<html>
<head>
<link rel="stylesheet" href="/bi/css1/default.css" type="text/css">
<title>Excel sql execute result page</title>
</head>
<body>
<table id="headTable" border="0" width="100%" cellspacing="0" cellpadding="0" class="dialogHeader" style="height:28px;" >
	<tr>
		<td id="titleContainer" class="dialogHeaderTitle" style="width:100%;padding-left:10px;">
		<font size="2px">寿再后台脚本执行结果页面</font></td>
    </tr>
</table>
<h2>Sql 脚本执行结束！</h2>
<% 
 int taskIdProDim = 22000; //寿再维表预处理
 int taskIdYwzk = 52000;  //寿再业务总况导入任务
 int taskIdcqxght = 52001; //寿再长期险各合同总体经营状况导入任务
 int taskIdFj1ywzkb = 50016; //业务总况表(FJ1YWZKB)寿再
 
// Date dateKey = Date.valueOf("2010-06-01");
 String resultStr = "";
 String lastMonthDayStr = "";
 String curMonthDayStr = "";
 List<String> resultList = new ArrayList<String>();
 
 String endDataStr = request.getParameter("endDataDate");
 
 //数据截止日期月的第一天
 Calendar calendar = Calendar.getInstance();
 calendar.setTime(Date.valueOf(endDataStr));
 
 calendar.set(Calendar.DAY_OF_MONTH,calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
 lastMonthDayStr = (new SimpleDateFormat("yyyy-MM-dd")).format(calendar.getTime());
  
// curMonthDayStr = (new SimpleDateFormat("yyyy-MM-dd")).format(new java.util.Date(System.currentTimeMillis()+24*3600*1000));
 Date lastMonthDayDate = Date.valueOf(lastMonthDayStr);
 
 
 //指定日期的第二天
 calendar.setTime(Date.valueOf(endDataStr));
 calendar.add(Calendar.DAY_OF_MONTH,1);
 curMonthDayStr = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
 Date curMonthDayDate = Date.valueOf(curMonthDayStr);
 
 //执行寿再维表预处理
 resultStr = PipelineFactory.runTaskById(taskIdProDim,curMonthDayDate);
 resultList.add("寿再维表预处理-->"+resultStr);
 
 //执行上月业务总况
 resultStr = PipelineFactory.runTaskById(taskIdYwzk,lastMonthDayDate);
 resultList.add("寿再业务总况导入任务,上月-->"+resultStr);
 
 //执行本月业务总况
 resultStr = PipelineFactory.runTaskById(taskIdYwzk,curMonthDayDate);
 resultList.add("寿再业务总况导入任务,本月-->"+resultStr);
 
 //执行上月长期险各合同总体经营状况导入任务
 resultStr = PipelineFactory.runTaskById(taskIdcqxght,lastMonthDayDate);
 resultList.add("寿再长期险各合同总体经营状况导入任务,上月-->"+resultStr);
 
 //执行长期险各合同总体经营状况导入任务
 resultStr = PipelineFactory.runTaskById(taskIdcqxght,curMonthDayDate);
 resultList.add("寿再长期险各合同总体经营状况导入任务,本月-->"+resultStr);
 
 //执行上月业务总况集团汇总
 resultStr = PipelineFactory.runTaskById(taskIdFj1ywzkb,lastMonthDayDate);
 resultList.add("业务总况表(FJ1YWZKB)寿再汇总任务,上月-->"+resultStr);
 

 //执行本月业务总况集团汇总
// resultStr = PipelineFactory.runTaskById(taskIdFj1ywzkb,curMonthDayDate);
// resultList.add("业务总况表(FJ1YWZKB)寿再汇总任务,本月-->"+resultStr);
 
 for(int i=0; i<resultList.size(); i++){
 	out.println(resultList.get(i)+"<br>");
 }
%>
<table border="0" width="100%" cellpadding="1" cellspacing="0" class="dialogButtonBar" id="FooterContainer" style="margin-top:20px;height:50px;">	
	<tr>
		<td nowrap class="copyright" id="LegalContainer">技术支持 Git;高伟达软件技术有限公司</td>
	</tr>
</table>
</body>
</html>